package com.kindsoft.demo.scheduling.tasks;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.LocalTime;

/**
 * Created by zhoujm on 2020/2/12/012.
 */
@Component
@EnableScheduling
public class SampleScheduleTask {

    private final Logger log = LoggerFactory.getLogger(this.getClass());

    private int count = 0;

    @Scheduled(cron = "* */10 * * * ?")
    private void process() {
        log.info("this is scheduler task runing  " + (count++));
        log.info("当前时间：" + LocalTime.now());
    }
}
